window.onload = function() {
    var combox = document.getElementById("common_box");
    var cli_on = document.getElementById("cli_on");
    var flag = true, timer = null, initime = null, r_len = 0;
    cli_on.onclick = function () {
     /*如果不需要动态效果，这两句足矣
     combox.style.right = flag?'-270px':0;
     flag = !flag;
     */
     clearTimeout(initime);
     //根据状态flag执开展开收缩
     if (flag) {
      r_len = 0;
      timer = setInterval(slideright, 10);
     } else {
      r_len = -270;
      timer = setInterval(slideleft, 10);
     }
    }
    //展开
    function slideright() {
     if (r_len <= -270) {
      clearInterval(timer);
      flag = !flag;
      return false;
     } else {
      r_len -= 5;
      combox.style.right = r_len + 'px';
     }
    }
    //收缩
    function slideleft() {
     if (r_len >= 0) {
      clearInterval(timer);
      flag = !flag;
      return false;
     } else {
      r_len += 5;
      combox.style.right = r_len + 'px';
     }
    }
    //加载后3秒页面自动收缩
    initime = setTimeout("cli_on.click()", 3000);
   }